Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: shared cache for manual peering #114

Merged
merged 4 commits into from
Apr 22, 2024
Merged

feat: shared cache for manual peering #114

merged 4 commits into from
Apr 22, 2024

Conversation

hacdias
Copy link
Member

@hacdias hacdias commented Apr 8, 2024

CC #109 #27

@hacdias hacdias self-assigned this Apr 8, 2024
@hacdias hacdias changed the title fix: enable holepunching feat: add shared cache Apr 8, 2024
@hacdias hacdias force-pushed the feat/shared-cache branch 2 times, most recently from c7e3924 to 9f64e24 Compare April 8, 2024 13:39
@hacdias hacdias changed the title feat: add shared cache feat: peering shared cache Apr 8, 2024
@hacdias hacdias force-pushed the feat/shared-cache branch 2 times, most recently from 8e9ddf7 to ee70d5d Compare April 8, 2024 13:42
Comment on lines -324 to 365
bswap := bsclient.New(bsctx, bn, blkst,
bswap := bitswap.New(bsctx, bn, blkst,
// --- Client Options
// default is 1 minute to search for a random live-want (1
// CID). I think we want to search for random live-wants more
// often although probably it overlaps with general
// rebroadcasts.
bsclient.RebroadcastDelay(delay.Fixed(10*time.Second)),
bitswap.RebroadcastDelay(delay.Fixed(10*time.Second)),
// ProviderSearchDelay: default is 1 second.
bsclient.ProviderSearchDelay(time.Second),
bsclient.WithoutDuplicatedBlockStats(),
bitswap.ProviderSearchDelay(time.Second),
bitswap.WithoutDuplicatedBlockStats(),

// ---- Server Options
bitswap.WithPeerBlockRequestFilter(peerBlockRequestFilter),
bitswap.ProvideEnabled(provideEnabled),
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option here would be to create only a client with bsclient.New if peering cache is disabled. But to me it seemed that a peer block request filter that always returns false should do the same thing. Depends a bit more on the internals of the bitswap package.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be ok, but we should measure our libp2p egress bandwidth to hosts we don't control to see to validate that this is true.

@@ -0,0 +1,94 @@
package main
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ Just moved some shared test utilities to this file.

@hacdias hacdias marked this pull request as ready for review April 8, 2024 13:48
main.go Outdated Show resolved Hide resolved
setup_test.go Outdated Show resolved Hide resolved
setup_test.go Outdated Show resolved Hide resolved
setup_test.go Outdated Show resolved Hide resolved
main.go Show resolved Hide resolved
Base automatically changed from feat/accelerated-dht-flag to main April 9, 2024 09:46
@hacdias hacdias requested a review from lidel April 9, 2024 12:21
@hacdias hacdias force-pushed the feat/shared-cache branch 2 times, most recently from f1ed448 to c011630 Compare April 17, 2024 09:25
@hacdias hacdias force-pushed the feat/shared-cache branch 2 times, most recently from 7d7a783 to e259336 Compare April 18, 2024 06:57
@lidel lidel modified the milestones: v1.1, v1.2 Apr 19, 2024
@lidel lidel changed the title feat: peering shared cache feat: shared cache for manual peering Apr 19, 2024
@lidel lidel modified the milestones: v1.2, v1.1 Apr 19, 2024
@lidel lidel force-pushed the feat/shared-cache branch 2 times, most recently from 0558af0 to ae6d7cc Compare April 20, 2024 00:14
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, pushed small cosmetics, should be good to ship as v1.1.0 (but see #102 (review) first)

@hacdias hacdias enabled auto-merge (squash) April 22, 2024 05:56
@hacdias hacdias merged commit 1710b56 into main Apr 22, 2024
11 checks passed
@hacdias hacdias deleted the feat/shared-cache branch April 22, 2024 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: 🎉 Done
Development

Successfully merging this pull request may close these issues.

3 participants